<?php

namespace plugin\ycMassage\app\admin\controller;

use plugin\ycMassage\app\BaseController;
use app\common\trait\plugin\PublicsTrait;
use plugin\ycMassage\app\model\PluginAdmin;

/**
 * 公共控制器
 *
 * @author 贵州猿创科技有限公司
 * @Email 416716328@qq.com
 * @DateTime 2023-03-07
 */
class PublicsController extends BaseController
{
    use PublicsTrait;

    /**
     * 应用ID（null则获取系统配置）
     * @var int|null
     * @author 贵州猿创科技有限公司
     * @email 416716328@qq.com
     */
    protected $saas_appid = null;

    /**
     * 模型
     * @var PluginAdmin
     * @author 贵州猿创科技有限公司
     * @email 416716328@qq.com
     */
    protected $model = null;

    /**
     * 构造函数
     * @return void
     * @author 贵州猿创科技有限公司
     * @copyright 贵州猿创科技有限公司
     * @email 416716328@qq.com
     */
    public function initialize()
    {
        parent::initialize();
        $this->saas_appid = $this->request->appid;
        if ($this->request->saas_appid) {
            $this->saas_appid = $this->request->saas_appid;
        }
        $this->model = new PluginAdmin;
        $domain = getHpConfig('domain', (int)$this->saas_appid, 'plugins_domains');
        $this->appendData = [
            'domain' => $domain,
            'web_url' => getHpConfig('web_url'),
            'plugin' => $this->request->plugin,
        ];
    }
}
